Table of Contents [Hide/Show]
Jetfire Code: To Do See Also
// To Do Workflow //=================================================================================== // ToDo.txt //=================================================================================== // Copyright (C) 2007 TrackerRealm Corporation // This file is part of Jetfire. // // Jetfire is open software: you can redistribute it and/or modify it under the terms // of the GNU General Public License as published by the Free Software Foundation, // version 3 of the License. // // Jetfire is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along with Jetfire. // If not, see http://www.gnu.org/licenses. // REMOVAL OF THIS NOTICE IS VIOLATION OF THE COPYRIGHT. //=================================================================================== namespace JetfireApps { public workflow ToDoList { // C O N S T R U C T O R - Instantiate the ToDoList // The ToDoList starts in the Start State. public ToDoList() { enterstate Start(); Subject = "To Do List"; } // P R O P E R T I E S public List ToDoItems { get; private set; } // S T A T E M E T H O D S // State Transition Command Comment // New -> Start new The workflow enters the start state when instantiated // Start -> Cancelled Cancel The To Do List is not required // Start -> Completed Complete This is an end state // public Start() { } public Scheduled() { } public Cancelled() { } public Completed() { } // C O M M A N D S // The Cancel command can be used in the Start and Scheduled states by the Organizer public void Cancel() : states(Start, Scheduled) { enterstate Cancelled(); } // The Complete command can be used in the Scheduled state public void Complete() : states(Scheduled) { enterstate Completed(); } public ToDoItem AddToDoItem() { ToDoItem item = new ToDoItem(); ToDoItems.Add(item); return item; } } // ToDoItem inherits from Schedule. public workflow ToDoItem : Schedule { public ToDoItem() { enterstate Start(); Subject = "To Do Item"; } // Properties // State Methods - same as ToDoList // Commands - same as ToDoList // S T A T E M E T H O D S // State Transition Command Comment // New -> Start new The workflow enters the start state when instantiated // Start -> Scheduled Schedule // Scheduled -> Start UnSchedule The user un-scheduled the appointment // Scheduled -> Scheduled Schedule The user rescheduled the appointment // Start -> Cancelled Cancel // Scheduled -> Cancelled Cancel This is an end state // Scheduled -> Completed Complete This is an end state // public Start() { } public Scheduled() { } public Cancelled() { } public Completed() { } // C O M M A N D S // The Schedule command can be used in the Start and Scheduled states public void Schedule() : states(Start, Scheduled) { StartDateTime = DateTime.Today; EndDateTime = DateTime.Today; enterstate Scheduled(); } // The Unschedule command can be used in the Scheduled states by the Organizer public void Unschedule() : states(Scheduled) { enterstate Start(); } // The Cancel command can be used in the Start and Scheduled states by the Organizer public void Cancel() : states(Start, Scheduled) { enterstate Cancelled(); } // The Complete command can be used in the Scheduled state public void Complete() : states(Scheduled) { enterstate Completed(); } } }